From 746a73f38606a584523cb614016e98b4db7ef98c Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 19 Aug 2009 07:08:57 +0000 Subject: [PATCH] * net/dbus.el (top): Apply `dbus-init-bus' for the :session bus only if it is running already. --- lisp/net/dbus.el | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index c1222a66f66..159fcb668dd 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -41,15 +41,6 @@ (defvar dbus-debug) (defvar dbus-registered-functions-table) -;; Initialize :system and :session buses. This adds their file -;; descriptors to input_wait_mask, in order to detect incoming -;; messages immediately. -;; We must avoid to call the function twice for a bus, because the -;; DBusWatch will be removed then. -(when (and (featurep 'dbusbind) (not (featurep 'dbus))) - (dbus-init-bus :system) - (dbus-init-bus :session)) - ;; Pacify byte compiler. (eval-when-compile (require 'cl)) @@ -841,6 +832,14 @@ name of the property, and its value. If there are no properties, (cons property (dbus-get-property bus service path interface property)) 'append))))) +;; Initialize :system and :session buses. This adds their file +;; descriptors to input_wait_mask, in order to detect incoming +;; messages immediately. +(dbus-ignore-errors + (dbus-init-bus :system) + (when (getenv "DBUS_SESSION_BUS_ADDRESS") + (dbus-init-bus :session))) + (provide 'dbus) ;; arch-tag: a47caf84-9162-4811-90cc-5d388e37b9bd -- 2.30.2